#include <iostream>

int parity_check(const unsigned char* msg, const int msg_length) {
    int count = 0;
    for (int i = 0; i < msg_length; i++) {
        if (msg[i] != 0) {
            count++;
        }
    }
    return (count % 2 == 0) ? 1 : 0;
}

int main() {
    unsigned char msg1[] = { 0, 1, 0, 1, 0 };
    int msg1_length = sizeof(msg1) / sizeof(msg1[0]);
    std::cout << "Test 1: " << (parity_check(msg1, msg1_length) ? "Pass" : "Fail") << std::endl;

    unsigned char msg2[] = { 0, 1, 0, 1, 1 };
    int msg2_length = sizeof(msg2) / sizeof(msg2[0]);
    std::cout << "Test 2: " << (parity_check(msg2, msg2_length) ? "Pass" : "Fail") << std::endl;

    unsigned char msg3[] = { 1, 1, 1, 1, 1 };
    int msg3_length = sizeof(msg3) / sizeof(msg3[0]);
    std::cout << "Test 3: " << (parity_check(msg3, msg3_length) ? "Pass" : "Fail") << std::endl;

    unsigned char msg4[] = { 0, 0, 0, 0, 0 };
    int msg4_length = sizeof(msg4) / sizeof(msg4[0]);
    std::cout << "Test 4: " << (parity_check(msg4, msg4_length) ? "Pass" : "Fail") << std::endl;

    return 0;
}